<template>
  <div class="singlePage">
    <leftMenu :menuList="menuList"></leftMenu>
    <div class="content">
      <leftTree @getSelectNode="getSelectNode"
                ref="leftTree" :has-btn="false"
                @goAdd="goAdd" show-out="in"></leftTree>
      <myTable class="myTable" ref="table"></myTable>
    </div>
    <el-dialog :title="undefined===form.id?'新增':'编辑'"
               :visible.sync="dialogVisible"
               :destroy-on-close="true"
               :close-on-click-modal="false"
               width="500px">
      <el-form ref="form"
               :model="form"
               label-width="80px">
        <el-form-item label="上级栏目">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="栏目名称">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer"
            class="dialog-footer">
        <el-button @click="dialogVisible=false">取 消</el-button>
        <el-button type="primary"
                   @click="sub">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import leftMenu from '@/components/leftMenu'
import leftTree from '@/components/module/leftTree'
import myTable from './components/table.vue'

export default {
  name: 'contentManage',
  components: {
    leftMenu,
    leftTree,
    myTable,
  },
  data() {
    return {
      menuList: [
        {
          title: '栏目管理',
          name: 'columnManage',
        },
        {
          title: '内容管理',
          name: 'contentManage',
        },
      ],
      dialogVisible: false,
      form:{}
    }
  },
  methods: {
    getSelectNode(node) {
      /*this.$refs.leftList.tableData = node.childleftTreeVOS
      this.$refs.leftList.parentNode = node*/
      if('1'===node.isThirdNode){
        return
      }
      console.log(node)
      console.log(897999)
      if(7!==node.id){
        this.$refs.table.form.col=node.id
      }else{
        this.$refs.table.form.col=null
      }
      this.$refs.table.formDate=node
      this.$refs.table.getTable()
    },
    goAdd() {
      this.dialogVisible = true
    },
    handlerDelete() {
      this.$refs.leftTree.$refs.commonleftTree.getleftTree()
    },
  },
}
</script>

<style scoped lang="less">
.singlePage {
  display: flex;
  .content {
    margin: 20px 15px;
    display: flex;
    flex: 1;
    overflow: hidden;
    .myTable {
      border-left: 1px solid #eee;
      flex: 1;
      height: 100%;
      background-color: #fff;
      padding: 10px;
    }
  }
}
</style>
